home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Include / cobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-03  |  1.7 KB  |  55 lines

  1. #ifndef Py_COBJECT_H
  2. #define Py_COBJECT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. /* C objects to be exported from one extension module to another.
  8.  
  9.    C objects are used for communication between extension modules.
  10.    They provide a way for an extension module to export a C interface
  11.    to other extension modules, so that extension modules can use the
  12.    Python import mechanism to link to one another.
  13.  
  14. */
  15.  
  16. extern DL_IMPORT(PyTypeObject) PyCObject_Type;
  17.  
  18. #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
  19.  
  20. /* Create a PyCObject from a pointer to a C object and an optional
  21.    destrutor function.  If the second argument is non-null, then it
  22.    will be called with the first argument if and when the PyCObject is
  23.    destroyed.
  24.  
  25. */
  26. extern DL_IMPORT(PyObject *)
  27. PyCObject_FromVoidPtr Py_PROTO((void *cobj, void (*destruct)(void*)));
  28.  
  29.  
  30. /* Create a PyCObject from a pointer to a C object, a description object,
  31.    and an optional destrutor function.  If the third argument is non-null,
  32.    then it will be called with the first and second arguments if and when 
  33.    the PyCObject is destroyed.
  34. */
  35. extern DL_IMPORT(PyObject *)
  36. PyCObject_FromVoidPtrAndDesc Py_PROTO((void *cobj, void *desc,
  37.                                        void (*destruct)(void*,void*)));
  38.  
  39. /* Retrieve a pointer to a C object from a PyCObject. */
  40. extern DL_IMPORT(void *)
  41. PyCObject_AsVoidPtr Py_PROTO((PyObject *));
  42.  
  43. /* Retrieve a pointer to a description object from a PyCObject. */
  44. extern DL_IMPORT(void *)
  45. PyCObject_GetDesc Py_PROTO((PyObject *));
  46.  
  47. /* Import a pointer to a C object from a module using a PyCObject. */
  48. extern DL_IMPORT(void *)
  49. PyCObject_Import Py_PROTO((char *module_name, char *cobject_name));
  50.  
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* !Py_COBJECT_H */
  55.